POST: http://www.nomedoseusite.com.br/api_categories.php?action=add_categories
Parameter | Format | Description |
categories_name | JSON |
Categorie or Sub-Categorie Name |
categories_status | JSON | 1 = ACTIVE or 0 = INACTIVE Only number is required Format: int(1) * FIELD REQUIRED |
main_category | JSON | Main Category of Sub-Category Only number is required Check the API to get the ID of the categories or sub-categories Format: int(11) * FIELD REQUIRED |
sort_order | JSON | Sort Order Only number is required Format: int(3) |
meta_title | JSON | Meta Title Format: text |
meta_description | JSON | Meta Description Format: text |
meta_keywords | JSON | Meta Keywords Format: text |
PHP Sample
// sample add categories and sub-categories $url = $domain_url . '/api_categories.php?action=add_categories'; $data = array("categories_name" => "Categorie or Sub-Categorie Name", // Categorie or Sub-Categorie Name * FIELD REQUIRED "categories_status" => "1", // 1 = ACTIVE or 0 = INACTIVE (Only number is required) * FIELD REQUIRED "main_category" => "0", // Main Category of Sub-Category (Only number is required) * FIELD REQUIRED "sort_order" => "", // Sort Order (Only number is required) "meta_title" => "Meta Title", // Meta Title "meta_description" => "Meta Description", // Meta Description "meta_keywords" => "Meta Keywords" ); $data_string = json_encode($data); $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', "Cache-Control: no-cache", 'Usuario1: ' . base64_encode($usuario1), 'Senha1: ' . base64_encode($senha1), 'Content-Length: ' . strlen($data_string)) ); $result = curl_exec($ch); curl_close($ch); print_r($result); // sample add categories and sub-categories eof
Return Error:
code
message
Return Success:
code
id
message